#define _CRT_SECURE_NO_WARNINGS
#include<stdlib.h>
#include<stdio.h>
int main()
{
	//malloc
	int* arr1 = (int*)malloc(sizeof(int) * 5);
	int i = 0;
	if (arr1 == NULL)
	{
		return 1;
	}
	else
	{
		for (i = 0; i < 5; i++)
		{
			*(arr1 + i) = i + 1;
			printf("%d ", arr1[i]);
		}
		printf("\n");
		free(arr1);
		arr1 = NULL;
	}
	//calloc
	int* arr2 = (int*)calloc(5, sizeof(int));
	if (arr2 == NULL)
	{
		return 1;
	}
	else
	{
		for (i = 0; i < 5; i++)
		{
			*(arr2 + i) = i + 1;
			printf("%d ", arr2[i]);
		}
		printf("\n");
		//free(arr2);
		//arr2 = NULL;
	}
	//realloc
	int* arr3 = (int*)realloc(arr2, sizeof(int) * 10);
	if (arr3 == NULL)
	{
		return 1;
	}
	else
	{
		for (i = 5; i < 10; i++)
		{
			*(arr3 + i) = i + 1;
		}
		for (i = 0; i < 10; i++)
		{
			printf("%d ", arr3[i]);
		}
		free(arr3);
		arr3 = NULL;
	}
	return 0;
}